package code.obj
{
	import code.utils.TimeUtil;

	public class TimeObj
	{
		public var totalTime:int;
		public var hour:int;
		public var minute:int;
		public var second:int;
		
		public function TimeObj()
		{
		}
		
		/**
		 *  此方法目前有2个备用方案，格式不同
		 * @return 
		 */
		public function toString():String
		{
			return planB();
		}
		
		/**
		 *例如：1小时8分5秒，3小时27秒，5分10秒 
		 */
		private function planA():String
		{
			var returnString:String = "";
			if(hour > 0)
			{
				returnString += hour.toString()+"小时";
			}
			
			if(minute > 0)
			{
				returnString += minute+"分";
			}
			
			if(second > 0)
			{
				returnString += second+"秒";
			}
			
			return returnString;
		}
		
		/**
		 * 例如：00:07:25 , 01:00:08
		 */
		private function planB():String
		{
			var returnString:String = "";
			
			if(hour >= 10)
			{
				returnString += hour.toString()+":";
			}else if (hour >= 0)
			{
				returnString += "0"+hour+":";
			}
			
			if(minute >= 10)
			{
				returnString += minute+":";
			}else if(minute >= 0)
			{
				returnString += "0"+minute+":";
			}
			
			if(second >= 10)
			{
				returnString += second;
			}else if(second >= 0)
			{
				returnString += "0"+second;
			}
			
			return returnString;
		}
	}
}